﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace RestaurantBooker.Controls
{
    /// <summary>
    /// Provides ability to navigate through list of available frames
    /// </summary>
    public class FramesNavigator : Control
    {
        public FramesNavigator()
        {
            this.DefaultStyleKey = typeof(FramesNavigator);
        }

        //private ListBox _framesListBox;

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //// unsubscribe event handlers for previous template parts
            //if (this._framesListBox != null)
            //{
            //    this._framesListBox.SelectionChanged -= _framesListBox_SelectionChanged;
            //}

            //_framesListBox = GetTemplateChild("FramesListBox") as ListBox;
            //_framesListBox.SelectionChanged += new SelectionChangedEventHandler(_framesListBox_SelectionChanged);

            //if (_framesListBox.SelectedItem != null)
            //    _framesListBox_SelectionChanged(_framesListBox.SelectedItem, null);
        }

        void _framesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //FrameDescription currentFrame = _framesListBox.SelectedItem as FrameDescription;
            //if (currentFrame != null)
            //    ViewModelLocator.MainStatic.OpenFrameByFrameDescription(currentFrame, true);
        }
    }
}
